package com.hxzy.controller.businessresourcesupplier;

import com.alibaba.fastjson.JSONObject;
import com.hxzy.common.BaseServlet;
import com.hxzy.dto.BusinessResourceDTO;
import com.hxzy.entity.BusinessResourceSupplier;
import com.hxzy.service.BusinessResourceSupplierService;
import com.hxzy.service.impl.BusinessResourceSupplierServiceIpmi;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description:
 * @Author: YaoHaiLong
 * @Date: 2022/3/8 21:58
 */
@WebServlet(urlPatterns = "/select/business")
public class Select extends BaseServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        super.startPage(req);
        try {
            //2、收集参数
            BusinessResourceDTO businessResourceDTO = super.CollectiongParameterToJSON(req, BusinessResourceDTO.class);
            //3、查询数据
            BusinessResourceSupplierService businessResourceSupplierService=new BusinessResourceSupplierServiceIpmi();
            BusinessResourceSupplier businessResourceSupplier1 = businessResourceSupplierService.searchByName(businessResourceDTO.getCreateUserId());


            //返回给客户端
           super.render(resp, JSONObject.toJSONString(businessResourceSupplier1));

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
